package com.mengtian_tech.tju.dataquery.api.config;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;

@Configuration
@EnableJpaRepositories(
		basePackages = { "com.mengtian_tech.tju.dataquery.api.repo.tjuOracle" },
 		entityManagerFactoryRef = "tjuOracleEntityManagerFactory"		
)
public class JPATjuOracleConfig {

	 
 

	@Bean(name = "tjuOracleEntityManagerFactory") // 指定Bean的名称。
	public LocalContainerEntityManagerFactoryBean secondaryEntityManagerFactory(EntityManagerFactoryBuilder builder,
			@Qualifier("dataSourceThimis") DataSource dataSource) { // 使用@Qualifier指定数据源。
		return builder.dataSource(dataSource).packages("com.mengtian_tech.tju.dataquery.api.model.tjuOracle")
				.persistenceUnit("tjuOracle").build(); // 指定实体类包和持久化单元名称。
	}

	 
}
